# Maintainer: Frederic Wang <fred.wang@free.fr>

_realname=characteristic
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=14.3.0
pkgrel=2
pkgdesc='Python attributes without boilerplate (mingw-w64)'
url='https://characteristic.readthedocs.io/'
license=('MIT')
arch=('any')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
             "${MINGW_PACKAGE_PREFIX}-python3")
source=("https://pypi.python.org/packages/source/c/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('ded68d4e424115ed44e5c83c2a901a0b6157a959079d7591d92106ffd3ada380')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python2
  cp -r ${_realname}-${pkgver} build-python3
}

package_python3-characteristic() {
  cd ${srcdir}/build-python3
  ${MINGW_PREFIX}/bin/python3 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
}

package_python2-characteristic() {
  cd ${srcdir}/build-python2
  ${MINGW_PREFIX}/bin/python2 setup.py build
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}"

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}

package_mingw-w64-i686-python2-characteristic() {
  package_python2-characteristic
}

package_mingw-w64-i686-python3-characteristic() {
  package_python3-characteristic
}

package_mingw-w64-x86_64-python2-characteristic() {
  package_python2-characteristic
}

package_mingw-w64-x86_64-python3-characteristic() {
  package_python3-characteristic
}
